<script src="__CDN__/assets/js/require{$Think.config.app_debug?'':'.min'}.js" data-main="__CDN__/assets/js/require-frontend{$Think.config.app_debug?'':'.min'}.js?v={$site.version|htmlentities}"></script>
<script type="text/javascript" src="__CDN__/assets/js/unocss/global.js?v={$site.version|htmlentities}"></script>
{if $Think.config.app_debug && $Think.config.app_trace}
<script>
    // <![CDATA[  <-- For Live Server In Dev
    if ('WebSocket' in window && location.port && location.port != '80') {
        (function () {
            function refreshCSS() {
                var sheets = [].slice.call(document.getElementsByTagName("link"));
                var head = document.getElementsByTagName("head")[0];
                for (var i = 0; i < sheets.length; ++i) {
                    var elem = sheets[i];
                    var parent = elem.parentElement || head;
                    parent.removeChild(elem);
                    var rel = elem.rel;
                    if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") {
                        var url = elem.href.replace(/(&|\?)_cacheOverride=\d+/, '');
                        elem.href = url + (url.indexOf('?') >= 0 ? '&' : '?') + '_cacheOverride=' + (new Date().valueOf());
                    }
                    parent.appendChild(elem);
                }
            }
            try {
                var address = 'ws://' + location.hostname + ':5500/ws';
                var socket = new window.WebSocket(address);
                socket.onmessage = function (msg) {
                    console.log('DEBUG DEV Socket', msg);
                    setTimeout(function () {
                        if (msg.data == 'reload') window.location.reload(true);
                        else if (msg.data == 'refreshcss') refreshCSS();
                    }, 500);
                };
                if (sessionStorage && !sessionStorage.getItem('IsThisFirstTime_Log_From_LiveServer')) {
                    console.log('Live reload enabled.');
                    sessionStorage.setItem('IsThisFirstTime_Log_From_LiveServer', true);
                }
            } catch (e) {
                console.log("DEBUG DEV Socket Error:", e);
            }
        })();
    }
	// ]]>
</script>
{/if}